﻿// <copyright file="WSTrust.cs" company="SharpSTS">
// Copyright (c) 2007, 2008 All Right Reserved, http://sharpsts.com/
//
// This source is subject to the Microsoft Permissive License.
// Please see the License.txt file for more information.
// All other rights reserved.
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY 
// KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
// PARTICULAR PURPOSE.
//
// </copyright>
// <author>Barry Dorrans</author>
// <email>barryd@idunno.org</email>
// <date>2008-06-20</date>
// <summary>Holds WSTrust constants.</summary>

namespace SharpSTS.Constants
{
    /// <summary>
    /// Holds WSTrust constants.
    /// </summary>
    internal static class WSTrust
    {
        /// <summary>
        /// Holds namespace constants.
        /// </summary>
        internal static class Namespace
        {
            /// <summary>
            /// The Namespace URI.
            /// </summary>
            public const string Uri = "http://schemas.xmlsoap.org/ws/2005/02/trust";

            /// <summary>
            /// The namespace prefix.
            /// </summary>
            public const string Prefix = "t";
        }

        /// <summary>
        /// Holds the constants for the actions and responses.
        /// </summary>
        internal static class Actions
        {
            /// <summary>
            /// The action for a request for a security token.
            /// </summary>
            public const string Issue = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Issue";

            /// <summary>
            /// The action for a response to request for a security token.
            /// </summary>
            public const string IssueResponse = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Issue";

            /// <summary>
            /// The action for a request to renew a security token.
            /// </summary>
            public const string Renew = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Renew";

            /// <summary>
            /// The action for a response to a request to renew a security token.
            /// </summary>
            public const string RenewResponse = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Renew";

            /// <summary>
            /// The action for a validation request for a security token.
            /// </summary>
            public const string Validate = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Validate";

            /// <summary>
            /// The action for a response to validation request for a security token.
            /// </summary>
            public const string ValidateResponse = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Validate";

            /// <summary>
            /// The action for a request to cancel a security token.
            /// </summary>
            public const string Cancel = "http://schemas.xmlsoap.org/ws/2005/02/trust/RST/Cancel";

            /// <summary>
            /// The action for a response to a request to cancel a security token.
            /// </summary>
            public const string CancelResponse = "http://schemas.xmlsoap.org/ws/2005/02/trust/RSTR/Cancel";
        }

        /// <summary>
        /// Holds attribute constants.
        /// </summary>
        internal static class Attributes
        {
            /// <summary>
            /// This mandatory attribute indicates the context for an RST.
            /// </summary>
            public const string Context = "Context";
        }

        /// <summary>
        /// Holds element names.
        /// </summary>
        internal static class Elements
        {
            /// <summary>
            /// This element defines how a token is encrypted.
            /// </summary>
            public const string EncryptWith = "EncryptWith";

            /// <summary>
            /// This element defines the encryption algorithm for a request.
            /// </summary>
            public const string EncryptionAlgorithm = "EncryptionAlgorithm";

            /// <summary>
            /// This element defines the collection of requested claims.
            /// </summary>
            public const string Claims = "Claims";

            /// <summary>
            /// This element defines the key type in the request.
            /// </summary>
            public const string KeyType = "KeyType";

            /// <summary>
            /// This element defines the key size in the request.
            /// </summary>
            public const string KeySize = "KeySize";

            /// <summary>
            /// This element defines the type of the request.
            /// </summary>
            public const string RequestType = "RequestType";

            /// <summary>
            /// This element is the parent for an RSTR.
            /// </summary>
            public const string RequestSecurityTokenResponse = "RequestSecurityTokenResponse";

            /// <summary>
            /// This element is the parent for an RST.
            /// </summary>
            public const string RequestSecurityToken = "RequestSecurityToken";
            
            /// <summary>
            /// This element encapsulates the requested token.
            /// </summary>
            public const string RequestedSecurityToken = "RequestedSecurityToken";

            /// <summary>
            /// This element encapsulates key identifier as an attached reference.
            /// </summary>
            public const string RequestedAttachedReference = "RequestedAttachedReference";

            /// <summary>
            /// This element encapsulates key identifier as an unattached reference.
            /// </summary>
            public const string RequestedUnattachedReference = "RequestedUnattachedReference";
            
            /// <summary>
            /// This element defines the signature algorithm requested in the RST.
            /// </summary>
            public const string SignWith = "SignWith";

            /// <summary>
            /// This element defines the token type in the RST and the RSTR.
            /// </summary>
            public const string TokenType = "TokenType";

            /// <summary>
            /// This element defines the key to use from the RST.
            /// </summary>
            public const string UseKey = "UseKey";

            /// <summary>
            /// This element defines the canonicalizatio algorithm requested in the RST.
            /// </summary>
            public const string CanonicalizationAlgorithm = "CanonicalizationAlgorithm";
        }

        /// <summary>
        /// Holds constants for the various request types.
        /// </summary>
        internal static class RequestTypes
        {
            /// <summary>
            /// Indicates an issue request.
            /// </summary>
            public const string Issue = "http://schemas.xmlsoap.org/ws/2005/02/trust/Issue";
        }

        /// <summary>
        /// Holds constants for token types.
        /// </summary>
        internal static class TokenTypes
        {
            /// <summary>
            /// Indicates the token is an SAML 1.0 token.
            /// </summary>
            public const string Saml10Assertion = "urn:oasis:names:tc:SAML:1.0:assertion";
        }

        /// <summary>
        /// Holds constants for key types.
        /// </summary>
        internal static class KeyTypes
        {
            /// <summary>
            /// Indicates an aysmmetric proof key in the request.
            /// </summary>
            public const string Asymmetric = "http://schemas.xmlsoap.org/ws/2005/02/trust/PublicKey";
        }

        /// <summary>
        /// Holds fault codes.
        /// </summary>
        internal static class FaultCodes
        {
            /// <summary>
            /// This fault code indicates the request was invalid.
            /// </summary>
            public const string InvalidRequest = "InvalidRequest";

            /// <summary>
            /// This fault code indicates the request failed.
            /// </summary>
            public const string RequestFailed = "RequestFailed";
        }
    }
}
